import request from "@/utils/request";
import {
  UserForm,
  UserList,
  UserQuery,
  UserPwdQuery,
  UserStatusQuery,
  UserChgpwdQuery,
  TenantList,
  UserInfo,
  chgUserInfoForm,
} from "./model";
// /tenant/ersu / index;
class UserAPI {
  /**
   * 获取分页列表
   *
   * @data data
   */
  static getPage(data: UserQuery) {
    return request<any, PageResult<UserList[]>>({
      url: "/tenant/user/index",
      method: "post",
      data: data,
    });
  }
  /**
   * 添加编辑
   *
   * @data data
   */

  static add(data: UserForm) {
    return request({
      url: "/tenant/user/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除
   *
   * @data data
   */

  static deleteByIds(data: Ids) {
    return request({
      url: "/tenant/user/del",
      method: "post",
      data: data,
    });
  }

  /**
   * 重置密码
   *
   * @data data
   */

  static resetPwd(data: UserPwdQuery) {
    return request({
      url: "/tenant/user/resetpwd",
      method: "post",
      data: data,
    });
  }

  /**
   * 修改状态
   *
   * @data data
   */

  static chgStatus(data: UserStatusQuery) {
    return request({
      url: "/tenant/user/chgstatus",
      method: "post",
      data: data,
    });
  }

  /**
   * 修改密码
   *
   * @data data
   */

  static chgpwd(data: UserChgpwdQuery) {
    return request({
      url: "/tenant/user/chgpwd",
      method: "post",
      data: data,
    });
  }

  /**
   * 修改密码
   *
   * @data data
   */

  static getInfo() {
    return request<any, UserInfo>({
      url: "/tenant/user/profile",
      method: "get",
    });
  }

  /**
   * 修改个人信息
   *
   * @data data
   */

  static chgUserInfo(data: chgUserInfoForm) {
    return request({
      url: "/tenant/user/profile",
      method: "post",
      data: data,
    });
  }

  /**
   * 人员列表
   *
   * @data data
   */
  static getTenantList(data: UserQuery) {
    return request<any, PageResult<TenantList[]>>({
      url: "/tenant/user/select",
      method: "post",
      data: data,
    });
  }
}

export default UserAPI;
